unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, GSPlugin, ComCtrls, StdCtrls, ExtDlgs, ExtCtrls;

type
  TForm1 = class(TForm)
    Button3: TButton;
    OpenPictureDialog1: TOpenPictureDialog;
    Button4: TButton;
    SavePictureDialog1: TSavePictureDialog;
    GroupBox1: TGroupBox;
    lvPlugs: TListView;
    GroupBox2: TGroupBox;
    Image1: TImage;
    Panel1: TPanel;
    procedure FormCreate(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure FillList;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses GSPluginIntf;

{ TForm1 }

procedure TForm1.FillList;
var i: integer;
begin
  lvPlugs.Clear;
  with PluginFactory do for i := 0 to pred(Count) do
    with lvPlugs.Items.Add do begin
      caption := extractFileName(Plugin[i].FileName);
      subItems.add(xpTypeStr[Plugin[i].PluginType]);
      subItems.add(xpIOToStr(Plugin[i].IOCaps));
      subItems.add(Plugin[i].TargetExt.CommaText);
      subItems.add(Plugin[i].Description);
    end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  PluginFactory.Load(extractFilePath(Application.ExeName));
  FillList;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  OpenPictureDialog1.Filter := PluginFactory.FilterString(xptTexture, xioRead);
  if OpenPictureDialog1.Execute then
    Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  SavePictureDialog1.InitialDir := ExtractFilePath(Application.ExeName);
  SavePictureDialog1.Filter := PluginFactory.FilterString(xptTexture, xioWrite);
  if SavePictureDialog1.Execute then
    Image1.Picture.SaveToFile(SavePictureDialog1.FileName);
end;

end.
 